<?php
/**
 * Created by PhpStorm.
 * User: kang
 * Date: 2019-09-07
 * Time: 12:16
 */

namespace app\Validate;
use think\Validate;

class Register extends Validate
{
    protected $regex = [
        'mobile' => '/^13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9}$|17[0-9]{9}$/'
    ];
    protected $rule =   [
        'nickname'      => 'require|max:20',
        'mobile'        => 'regex:mobile|unique:member,is_del=0&is_hid=0',
        'password'    => 'require|length:6,18|confirm'
    ];

    protected $message  =   [
        'nickname.require' => '请填写姓名',
        'nickname.max'     => '姓名最长不能超过10位',
        'mobile.regex'     => '手机号码格式错误',
        'mobile.unique'     => '手机号码已存在，不能重复使用',
        'password.require'     => '请设置登录凭证密码',
        'password.length'     => '登录凭证密码长度必须在6~18位之间',
        'password.confirm'  => '两次登录凭证密码输入不一致'
    ];
}